package top.kaoshanji.p3ch21a;

/**
 * 代码清单-p3ch21a-244页b：叶子节点的实现
 * @author kaoshanji
 * ^_^
 * create time 2025/3/25 21:15
 */
public class Leaf implements ILeaf {

    // 叶子节点的名称
    private String name = "";

    // 叶子的职位
    private String position = "";

    // 叶子节点的薪水
    private int salary = 0;

    // 通过构造函数传递信息
    public Leaf(String name, String position, int salary) {
        this.name = name;
        this.position = position;
        this.salary = salary;
    }

    @Override
    public String getInfo() {
        return "名称： " + this.name + "\t 职位： " + this.position + "\t 薪水： " + this.salary;
    }
}
